<template>
    <div class="box1">
        <van-card v-for="(i, index) in gwclist" :num="i.number" :price="i.goods_price" key='index' :title="i.goods_name"
            :thumb="i.goods_big_logo">
            <template #footer>
                <van-button size="mini" @click="jian_list1(i, index)">-</van-button>
                <van-button size="mini" @click="jia_list(i)">+</van-button>
            </template>
        </van-card>

        <van-submit-bar :price="6666" button-text="提交订单" @submit="onSubmit">
            <van-checkbox v-model="checked">全选</van-checkbox>
            <template #tip>
                你的收货地址不支持配送, <span @click="onClickLink">修改地址</span>
            </template>
        </van-submit-bar>

    </div>

</template>

<script setup>
import { usegwc } from '../../pinia';
import { storeToRefs } from 'pinia';
const { gwclist } = storeToRefs(usegwc())
const { jia_list } = usegwc()
import { showConfirmDialog } from 'vant';
const { jian_list } = usegwc()
const jian_list1 = (i) => {
    if (i.number === 1) {
        showConfirmDialog({
            title: '您确定要删除吗',
            message: i.goods_name,
        })
            .then(() => {
                // on confirm
            })
            .catch(() => {
                // on cancel
            });
    } else {
        jian_list(i)
    }
}
const onSubmit = () => console.log('提交订单');
;
const onClickLink = () => showToast('修改地址');
</script>

<style>
.box1 {
    position: relative;
}
</style>